# coding=utf-8
from django.shortcuts import render
from django.http import HttpResponse


# Create your views here.
def version(request):
    from django import get_version
    v = get_version()
    return HttpResponse(v)

def VERSION(request):
    from django import VERSION
    v = [str(i) for i in VERSION]
    html = """
    <p>Django Version: %s</p>
    <p>
    <br/><a href='/version'>version</a>
    <br/><i>url(r'^version$', 'app.views.version')</i>
    <br/>def version(request):
    <br/>&nbsp;&nbsp;from django import get_version
    <br/>&nbsp;&nbsp;v = get_version()
    <br/>&nbsp;&nbsp;return HttpResponse(v)
    <br/>
    <br/><a href='/'>version</a>
    <br/><i>url(r'^$', 'app.views.VERSION')</i></i>
    <br/>def VERSION(request):
    <br/>&nbsp;&nbsp;from django import VERSION
    <br/>&nbsp;&nbsp;v = [str(i) for i in VERSION]
    <br/>&nbsp;&nbsp;html = "blablabla...""
    <br/>&nbsp;&nbsp;return HttpResponse(html)
    </p>
    """ % str('.'.join(v))
    return HttpResponse(html)

def get_environ(request):
    import os
    import sae
    const = sae.const
    return HttpResponse(str(os.environ) +'</br>' + str(dir(const)))

